import { createRouter, RouteRecordRaw, createWebHashHistory } from "vue-router";
import Layout from '@/components/layout/Layout.vue'

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: Layout,
        children: [
            {
                path:'',
                meta:{title:'首页'},
                component:()=>import('@/views/home/index.vue')
            }

        ]
    },
    // 科室管理
    {
        path: '/hospital',
        component: Layout,
        meta: { title: '医院综合' },
        children: [
            {
                path: '/hospital/department',
                meta: { title: '科室管理' },
                component: () => import('@/views/hospital/department.vue')
            },
            {
                path: '/hospital/add',
                meta: { title: '添加科室' },
                component: () => import('@/views/hospital/department-add.vue')
            }
        ]
    },
    {
        path: '/personal',
        component: Layout,
        children: [
            {
                path: '',
                meta: { title: '动态个人' },
                component: () => import('@/views/personal/Personal.vue')
            }

        ]
    },
    {
        path: '/sickbed',
        component: Layout,
        children: [
            {
                path: '',
                meta: { title: '床位管理' },
                component: () => import('@/views/sickbed/Sickbad.vue')
            }

        ]
    },
    {
        path: '/doctorlist',
        component: Layout,
        children: [
            {
                path: '/doctorlist',
                meta: { title: '综合列表' },
                component: () => import('../views/doctor/doctorlist.vue')
            },
            {
                path: '/doctor',
                meta: { title: '排班管理' },
                component: () => import('../views/doctor/doctor.vue')
            },
            {
                path: '/doctoredit',
                meta: { title: '修改个人信息' },
                component: () => import('../views/doctor/doctoredit.vue')
            }
        ]
    },
    {
        path: '/:pathMatch(.*)*',
        component: () => import('@/views/error/Error.vue')
    },
]



const router = createRouter({
    routes,
    history: createWebHashHistory()
})

export default router


